package com.cy.store.util;

import lombok.Data;

import java.io.Serializable;

//将浏览器的响应信息封装，然后将该类对象返回给前端浏览器
//以JSON格式数据响应
@Data
public class JsonResult<E> implements Serializable {
    //状态码
    private Integer state;

    //状态描述信息
    private String message;

    //数据
    private E data;

    public JsonResult() {
    }

    public JsonResult(Integer state) {
        this.state = state;
    }

    public JsonResult(Throwable e) {
        this.message = e.getMessage();
    }

    public JsonResult(Integer state, E data) {
        this.state = state;
        this.data = data;
    }


}
